<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //翻转数组
        var arr = [1, 2, 3, 4, 5];
        arr.reverse();
        console.log(arr);

        //冒泡排序
        var arr1 = [2, 1, 5, 44, 8];

        arr1.sort(function (a, b) {
            return a - b;            // a-b升序   如果是 b-a就是降序
        });

        console.log(arr1);
    </script>
</head>

<body>

</body>

</html>